<template>
  <div id="app">
    <keep-alive>
      <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>
<script>
export default {
  data() {
    return {}
  },
  methods: {
    /** 初始化数据 */
    InitData() {
      if (!this.$route.meta.needLogin) {
        return
      }
    },
    isMobile() {
      let flag = navigator.userAgent.match(
        /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
      )
      return flag
    }
  },
  // 初始化之前
  beforeCreate() {},
  // 初始化之后
  created() {
    if (this.isMobile()) {
      document.querySelector('html').style.backgroundColor = '#F8F8F8'
    } else {
      document.querySelector('html').style.backgroundColor = '#fff'
    }
    this.InitData()
  },
  // 编译挂载之前
  beforeMount() {},
  // 编译挂载之后
  mounted() {},
  // 组件更新之前
  beforeUpdate() {},
  // 组件更新之后
  updated() {},
  // 组件销毁之前
  beforeDestroy() {},
  // 组件销毁之后
  destroyed() {},
  components: {}
}
</script>
<style></style>
